<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\modules\clinical\models\GeneInfo;

/* @var $this yii\web\View */
/* @var $model app\models\SamplePatient */
/* @var $form yii\widgets\ActiveForm */
$myParams['tube_total']['id'] = 'tube_total';
$myParams['dna_total']['id'] = 'dna_total';
$myParams['rna_total']['id'] = 'rna_total';
if (!$model->isNewRecord) {
    $myParams['tube_total']['readonly'] = true;
    $myParams['dna_total']['readonly'] = true;
    $myParams['rna_total']['readonly'] = true;
}

$dnaid_value = (Yii::$app->session->get("dna") == "") ? "L" : Yii::$app->session->get("dna");
?>

<div class="sample-from-form myForm">

    <div class="alert alert-danger" id="error-msg"></div>

    <?php $form = ActiveForm::begin(['id' => 'FromForm']); ?>

    <div id="sample-btn">

    <?= Html::Button("送测序公司", ['class' => 'btn btn-warning', 'id' => 'sample-deliver-btn']) ?>
    <?= Html::Button("取消", ['class' => 'btn btn-success', 'id' => 'sample-cancel-btn']) ?>

    </div><br />

    <div class="dna_id">
        <b>分子号</b>
        <?= Html::input('text', 'dna_id', $dnaid_value, ['class' => 'form-control', 'readonly' => true]) ?>
        <?= Html::a('<span class="glyphicon glyphicon-pencil"></span>', '#') ?>
    </div><br />

    <?= $form->field($model, 'tube_total')->textInput($myParams['tube_total'])->error(false) ?>

    <?= $form->field($model, 'tube_taker')->textInput(['maxlength' => true])->error(false) ?>

    <?= $form->field($model, 'tube_time')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?><br />

    <?= $form->field($model, 'tube_memo')->textArea(['maxlength' => true])->error(false) ?><br />

    <div id="sample-deliver">

    <?= $form->field($deliver, 'tube_deliver')->textInput()->error(false) ?>

    <?= $form->field($deliver, 'deliver_comp')->dropDownList(GeneInfo::getParams('deliver_comp'))->error(false) ?>

    <?= $form->field($deliver, 'deliver_using')->textInput(['maxlength' => true])->error(false) ?>
    
    <?= $form->field($deliver, 'deliver_time')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?><br />

    </div><br />

    <?= $form->field($model, 'dna_total')->textInput($myParams['dna_total'])->error(false) ?>

    <?= $form->field($model, 'dna_taker')->textInput(['maxlength' => true])->error(false) ?>

    <?= $form->field($model, 'dna_time')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?>

    <div class="alert alert-info position-table dna"></div><br />

    <?= $form->field($model, 'rna_total')->textInput($myParams['rna_total'])->error(false) ?>

    <?= $form->field($model, 'rna_taker')->textInput(['maxlength' => true])->error(false) ?>

    <?= $form->field($model, 'rna_time')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?>

    <div class="alert alert-info position-table rna"></div><br />

    <?php // if ($total != '') : ?>
    <input type="hidden" id="dna_total_last" value="<?= empty($total) ? 0 : $total['dna'] ?>">
    <input type="hidden" id="rna_total_last" value="<?= empty($total) ? 0 : $total['rna'] ?>">
    <?php // endif; ?>

    <input type="hidden" id="status" value="<?= $model->isNewRecord ? 'create-from' : 'update?id='.$model->pk_id ?>">
    <div class="form-group">
        <?= Html::Button($model->isNewRecord ? '保存' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'id' => 'submitButton']) ?>

        <?= Html::a('取消', ['/sample/view-from'], ['class' => 'btn btn-success']) ?>

    </div>

    <?php ActiveForm::end(); ?>

</div>
